const ul = document.querySelector(".hot_pickUp");


function getData(page){
    ajax({
        url: "/juhe",
        method: "get",
        data: {
            // type: type,
            page_size: 10,
            page,
            // offset: (dataPage - 1) * 19,
            // key: "c2a783ddad6cbf6b5aad459502bae549",

            key:"b8acdefa84ac17560cb78385d47febee",
        },
        dataType: "text",
        success(jsonVideo) {
            let videoObj = JSON.parse(jsonVideo)
            videoArr = videoObj["result"]["data"];
            // console.log(videoArr, typeof videoArr);
            renderHtml(videoArr)
        },
        fail(err) {
            console.log(err);
        }
    })
}


// 数据存本地
// function doAjax(type,successCallback){
//   ajax({
//       url: "/juhe",//能请求时用这个
//       url: "./data/top.json",//不能请求时用这个
//       data: {
//           type: "top",
//           key: "8e8a00aa31016dea7ef856dcec92bf06",
//       },
//       success(res) {
//           // console.log("success",res);
//           successCallback(res);
//       },
//       fail(err) {
//           console.log("err", err);
//       },
//   });
// }

// 渲染页面热点精选
console.log(ul);
// const ul = document.querySelector(".hy-video-list>.item>.clearfix");
function renderHtml(videoArr) {
    // ul.innerHTML = "";
    for (let i = 0; i < videoArr.length; i++) {
        const li = document.createElement("li");
        li.innerHTML = `<li id="20210530002541_1" class="item cf itme-ls" data-bosszone="new_list" data-pos="1"
        data-bossirs="&amp;articleid=20210530002541&amp;category=3&amp;category2=303&amp;category_ori=politics&amp;s_order=1&amp;articletype=120&amp;pool_type=24hours_pool&amp;source_id=undefined&amp;channel=main&amp;pagetype=ch">
        <a class="picture" href="${videoArr[i]["url"]}" target="_blank"><img
            class="Monograph" alt="${videoArr[i]["title"]}" src="${videoArr[i]["thumbnail_pic_s"]}"></a>
        <div class="detail">
          <h3 class=""><a href="${videoArr[i]["url"]}" target="_blank">
            <span class="zt">专题</span>${videoArr[i]["title"]}
            </a></h3>
          <div class="tags"></div>
          <div class="binfo cf">
            <div class="fl"><span class="source">${videoArr[i]["author_name"]}</span><span class="time">${videoArr[i]["date"]}</span></div>
            <div class="fr">
              <div class="i-share" tabindex="0"><span class="t">分享</span>
                <div class="panel"><a class="item qzone" data-bossirs="new_share" tabindex="0">QQ空间</a><a
                    class="item qq" data-bossirs="new_share" tabindex="0">QQ好友</a><a class="item sina"
                    data-bossirs="new_share" tabindex="0">新浪微博</a></div>
              </div>
            </div>
          </div>
        </div>
      </li>`;
        ul.appendChild(li);
    }
}



